package org.boulderfoodrescue.webapp.shared;

import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;

import org.boulderfoodrescue.webapp.client.pickuptimes.timepicker.PickupWindow;


public class Place implements Serializable{
  private static final long serialVersionUID = -6229506626933504078L;
  /**
   * The location name
   */
  protected String name;
  /**
   * The street address
   */
  protected String addressOne;
  /**
   * The city
   */
  protected String city;
  /**
   * The state
   */
  protected String state;
  /**
   * The zip code
   */
  protected String zip_code;
  /**
   * The username of the user. Currently the gmail account used to login
   */
  protected String username;
  /**
   * Amount of food available at the location
   */
  protected long amount;
  /**
   * Tells if the pickup repeats
   */
  protected Boolean repeats = false;
  /**
   * Expiration date of the food
   */
  protected long expiration_date;
  /**
   * Date saved
   */
  protected long saved;
  /**
   * Latitude of address
   */
  protected double latitude;
  /**
   * Logitude of address
   */
  protected double longitude;
  /**
   * Datastore key
   */
  protected Long key;
  /**
   * Contact email specified by the user. May be different then the username
   */
  protected String email;
  /**
   * Phone number of the user
   */
  protected String phone;
  /**
   * Any notes provided by the user
   */
  protected String notes;
  /**
   * The contact's name
   */
  protected String contact_name;
  /**
   * List of avaible pickup times
   */
  protected List<PickupWindow> pickup_times;
  
  public String topLineString(){
    return addressOne;
  }
  public String bottomLineString(){
    StringBuilder sb = new StringBuilder();
    sb.append(city);
    sb.append(" ");
    sb.append(state);
    sb.append(", ");
    sb.append(zip_code+"");
    return sb.toString();
  }
  public String toString(){
    StringBuilder sb = new StringBuilder();
    sb.append(addressOne);
    sb.append(" ");
    sb.append(city);
    sb.append(" ");
    sb.append(state);
    sb.append(", ");
    sb.append(zip_code+"");
    return sb.toString();
  }
  public String getName() {
    return name;
  }
  public void setName(String name) {
    this.name = name;
  }
  public String getAddressOne() {
    return addressOne;
  }
  public void setAddressOne(String addressOne) {
    this.addressOne = addressOne;
  }
  public String getCity() {
    return city;
  }
  public void setCity(String city) {
    this.city = city;
  }
  public String getState() {
    return state;
  }
  public void setState(String state) {
    this.state = state;
  }
  public String getZip_code() {
    return zip_code;
  }
  public void setZip_code(String zip_code) {
    this.zip_code = zip_code;
  }
  public Long getAmount() {
    return amount;
  }
  public void setAmount(Long amount) {
    this.amount = amount;
  }
  public Boolean getRepeats() {
  	return repeats;
  }
	public void setRepeats(Boolean repeats) {
  	this.repeats = repeats;
  }
	public long getExpiration_date() {
    return expiration_date;
  }
  public void setExpiration_date(long expiration_date) {
    this.expiration_date = expiration_date;
  }
  public String getUsername() {
    return username;
  }
  public void setUsername(String username) {
    this.username = username;
  }
  public long getSaved() {
    return saved;
  }
  public void setSaved(long saved) {
    this.saved = saved;
  }
  public double getLatitude() {
    return latitude;
  }
  public void setLatitude(double latitude) {
    this.latitude = latitude;
  }
  public double getLongitude() {
    return longitude;
  }
  public void setLongitude(double longitude) {
    this.longitude = longitude;
  }
  public Long getKey() {
    return key;
  }
  public void setKey(Long key) {
    this.key = key;
  }
  public String getEmail() {
    return email;
  }
  public void setEmail(String email) {
    this.email = email;
  }
  public String getPhone() {
    return phone;
  }
  public void setPhone(String phone) {
    this.phone = phone;
  }
  public String getNotes() {
    return notes;
  }
  public void setNotes(String notes) {
    this.notes = notes;
  }
  public String getContact_name() {
    return contact_name;
  }
  public void setContact_name(String contact_name) {
    this.contact_name = contact_name;
  }
	public List<PickupWindow> getPickup_times() {
		if(pickup_times == null)
			pickup_times = new LinkedList<PickupWindow>();
  	return pickup_times;
  }
	public void setPickup_times(List<PickupWindow> pickup_times) {
  	this.pickup_times = pickup_times;
  }
}
